package com.jtny.nytb.equipment.utils;


import com.jtny.nytb.equipment.vo.dataparam.AlgorithmExcelVO;
import com.jtny.nytb.equipment.vo.excel.*;
import com.jtny.nytb.equipment.vo.model.EquipmentModelParamExcelVO;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 智慧能源中心 - 伍天宇
 * @package com.jtny.nytb.energymonitor.equipment.utils
 * @fileName ExcelSheetUtil.java
 * @createTime 2023年10月11日 09:45
 * @Copyright© 2023 jtny
 * 江投能源技术研究院 版权所有
 */
public class ExcelSheetUtil {

    public static List<ExcelSheetVO> buildModelSheetList() {
        List<ExcelSheetVO> sheetList = new ArrayList<>();
        addEquipmentModelSheet(sheetList);
        addDataParamSheet(sheetList);
        return sheetList;
    }


    public static List<ExcelSheetVO> buildEquipmentSheetList() {
        List<ExcelSheetVO> sheetList = new ArrayList<>();
        addEquipmentSheet(sheetList);
        addDataParamSheet(sheetList);
        return sheetList;
    }


    public static List<ExcelSheetVO> buildEquipmentModelSheetList() {
        List<ExcelSheetVO> sheetList = new ArrayList<>();
        addEquipmentByModelSheet(sheetList);
        return sheetList;
    }

    private static void addEquipmentByModelSheet(List<ExcelSheetVO> sheetList) {
        ExcelSheetVO equipmentSheet = new ExcelSheetVO();
        equipmentSheet.setSheetName("设备");
        equipmentSheet.setClazz(ExcelModelRelationEquipmentVO.class);
        sheetList.add(equipmentSheet);
        ExcelSheetVO equipmentLabelSheet = new ExcelSheetVO();
        equipmentLabelSheet.setSheetName("设备关联标签");
        equipmentLabelSheet.setClazz(ExcelEquipmentLabelVO.class);
        sheetList.add(equipmentLabelSheet);
        ExcelSheetVO modelParamSheet = new ExcelSheetVO();
        modelParamSheet.setSheetName("设备参数");
        modelParamSheet.setClazz(EquipmentModelParamExcelVO.class);
        sheetList.add(modelParamSheet);
    }

    private static void addEquipmentSheet(List<ExcelSheetVO> sheetList) {
        ExcelSheetVO equipmentSheet = new ExcelSheetVO();
        equipmentSheet.setSheetName("设备");
        equipmentSheet.setClazz(ExcelEquipmentVO.class);
        sheetList.add(equipmentSheet);
        ExcelSheetVO equipmentLabelSheet = new ExcelSheetVO();
        equipmentLabelSheet.setSheetName("设备关联标签");
        equipmentLabelSheet.setClazz(ExcelEquipmentLabelVO.class);
        sheetList.add(equipmentLabelSheet);
        ExcelSheetVO modelParamSheet = new ExcelSheetVO();
        modelParamSheet.setSheetName("设备参数");
        modelParamSheet.setClazz(EquipmentModelParamExcelVO.class);
        sheetList.add(modelParamSheet);
    }

    private static void addEquipmentModelSheet(List<ExcelSheetVO> sheetList) {
        ExcelSheetVO equipmentModelSheet = new ExcelSheetVO();
        equipmentModelSheet.setSheetName("设备模型");
        equipmentModelSheet.setClazz(ExcelModelVO.class);
        sheetList.add(equipmentModelSheet);
        ExcelSheetVO modelParamSheet = new ExcelSheetVO();
        modelParamSheet.setSheetName("设备模型参数");
        modelParamSheet.setClazz(EquipmentModelParamExcelVO.class);
        sheetList.add(modelParamSheet);
    }

    private static void addDataParamSheet(List<ExcelSheetVO> sheetList) {
        ExcelSheetVO dataParamSheet = new ExcelSheetVO();
        dataParamSheet.setSheetName("设备模型参量");
        dataParamSheet.setClazz(ExcelDataParamVO.class);
        sheetList.add(dataParamSheet);

        ExcelSheetVO frequencySheet = new ExcelSheetVO();
        frequencySheet.setSheetName("参量频率");
        frequencySheet.setClazz(ExcelFrequencyVO.class);
        sheetList.add(frequencySheet);

        ExcelSheetVO algorithmSheet = new ExcelSheetVO();
        algorithmSheet.setSheetName("算法");
        algorithmSheet.setClazz(AlgorithmExcelVO.class);
        sheetList.add(algorithmSheet);

        ExcelSheetVO algorithmParamSheet = new ExcelSheetVO();
        algorithmParamSheet.setSheetName("算法参数");
        algorithmParamSheet.setClazz(ExcelAlgorithmParamVO.class);
        sheetList.add(algorithmParamSheet);

        ExcelSheetVO labelExcelSheet = new ExcelSheetVO();
        labelExcelSheet.setSheetName("参量标签");
        labelExcelSheet.setClazz(ExcelLabelVO.class);
        sheetList.add(labelExcelSheet);

        ExcelSheetVO alarmSheet = new ExcelSheetVO();
        alarmSheet.setSheetName("设备告警");
        alarmSheet.setClazz(ExcelAlarmVO.class);
        sheetList.add(alarmSheet);
    }

    public static List<ExcelSheetVO> buildInstrumentSheetList() {
        List<ExcelSheetVO> sheetList = new ArrayList<>();
        addInstrumentSheet(sheetList);
        return sheetList;
    }

    private static void addInstrumentSheet(List<ExcelSheetVO> sheetList) {
        ExcelSheetVO instrumentSheet = new ExcelSheetVO();
        instrumentSheet.setSheetName("重点用能单位计量器具基本信息");
        instrumentSheet.setClazz(ExcelInstrumentVO.class);
        sheetList.add(instrumentSheet);
        ExcelSheetVO instrumentReportSheet = new ExcelSheetVO();
        instrumentReportSheet.setSheetName("上报数据");
        instrumentReportSheet.setClazz(ExcelInstrumentReportVO.class);
        sheetList.add(instrumentReportSheet);
    }

}